package com.ruoyi.dwzzzy.modeler;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.dwzzzy.domain.QualifSource;
import com.ruoyi.dwzzzy.service.IQualifSourceService;
import com.ruoyi.system.domain.SysDictData;
import com.ruoyi.system.utils.DictUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description :
 * @auther :   zhanvie
 * @Date :   2021-03-24
 */
@Controller
@RequestMapping("business/page/dw")
public class DwModelerController extends BaseController {

    @Resource
    private IQualifSourceService qss;

    @RequestMapping("/list")
    public String modelList(HttpServletRequest request) {
        return "/business/business";
    }
    
    @RequestMapping("/dwadd")
    public String addList(HttpServletRequest request, ModelMap map) {
        List<SysDictData> business_res_type = DictUtils.getDictCache("business_res_type");
        map.put("business_res_type", business_res_type);
        return "/business/add";
    }

    @RequestMapping("/dwedit/{id}")
    public String edit(@PathVariable Long id, HttpServletRequest request, ModelMap map) {
        QualifSource qualifSource = qss.selectQualifSourceById(id);
        map.put("source", qualifSource);
        return "/business/edit";
    }

    @RequestMapping("/upload")
    public String upload(HttpServletRequest request) {
        return "/business/dwUpload";
    }
}
